1. Field of the Invention
The invention relates to an apparatus for generating a bitstream, and more particularly, to an apparatus for generating a bitstream utilizing a decision unit and a method thereof.
2. Description of the Prior Art
Sony/Philips Digital Interface Format (S/PDIF), also known as IEC 958 type II, is a data format for carrying pulse code modulated (PCM) digital audio signals between devices and stereo components. It is most commonly used in CD and DVD players. S/PDIF data utilizes bi-phase mark or ‘Manchester’ coding, which is DC free, self-clocking and capable of working with a changing sampling rate.
Please refer to FIG. 1. FIG. 1 is a diagram of a format of S/PDIF data according to the prior art. The data is divided into two sub-frames corresponding to a left and a right channel respectively. Each sub-frame consists of 32 bits. S/PDIF can be described as comprising sample words, i.e. data; and control words, which are the preamble and the status bits. The first 4 bits of the sub-frame (bits 0 to 3) are the preamble, used for synchronization. There are 3 different preamble/sync-patterns B, M, and W utilized in the S/PDIF format. Preamble B marks a word containing data for channel A (left) at the start of a block. Preamble M marks a word with data for channel A that is not at the start of a block. Preamble W marks a word containing data for channel B (right, for stereo).
Bits 4 to 28 are the audio sample. Bits that are not used are defined to be zero in S/PDIF. Four status bits (bits 28 to 31) accompany each sub-frame. Bit 28 (V) is the validity flag, which indicates whether the data received is suitable for conversion to an analog signal. Bit 29 is the user check. Bit 30 is the channel status. Bit 31 is the parity bit (P), which is meant for error correction at the destination, by ensuring the number of ‘1’s and ‘0’s' are even. The validity flag, user bit (U) and channel status (C) are collected to form validity, user and channel status blocks. S/PDIF data is transmitted in blocks of 192 frames, where the preamble B is used to denote the start of a block, i.e. frame 1.
Conventional apparatus for regenerating S/PDIF data extract a sample word and a control word of the data and send them to a FIFO buffer, which is clocked by a pixel clock and an audio clock. The sample word and control word are then sent to a transmitter (data format converter), which reconstructs the data, captures the channel status, and carries out a parity check.
In the related art, however, the audio clock sometimes is not transmitted directly to the receiver for decoding the data, but is obtained from the other related clock information as a ratio of one clock to the other, and can therefore have related noise. If noise exists in the audio stream it will cause some ‘0’s' to be erroneously converted to ‘1’s' and vice versa. This means the audio clock cannot be properly locked to the data, causing the data to be distorted, or even preventing the system from playing the data.